package string.intern;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO:intern()的使用 会降低空间使用
 *
 * <P> Date: 2022/3/20:10:35
 * <P> Description:
 */

public class StringInternTest3 {
    public static int MAX =1000*10000;
    public static String[] strs = new String[MAX];


    public static void main(String[] args) {
    int[] arr = {1,2,3,4,5,6,7,8,9,0};
        for (int i = 0; i < MAX; i++) {
            //strs[i] = new String(String.valueOf(arr[i % arr.length]));
            strs[i] = new String(String.valueOf(arr[i % arr.length])).intern();
        }

        try {
            Thread.sleep(100000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
